<template>
    <div class="manage-api">
        <div style="height: 35px">
            <el-form :model="searchForm" :inline="true" size="mini">
                <el-form-item label="name">
                    <el-input v-model="searchForm.path"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="listApi">Search</el-button>
                    <el-button type="primary" @click="listApi">Refresh</el-button>
                </el-form-item>
            </el-form>
        </div>
        <el-table
                border
                default-expand-all
                highlight-current-row
                :data="apiTable"
                row-key="ukId"
                height="500"
                size="mini"
                style="width: 100%">
            <el-table-column
                    prop="path"
                    label="path"
                    width="*">
            </el-table-column>
            <el-table-column
                    prop="total"
                    label="total"
                    width="150">
            </el-table-column>
        </el-table>
    </div>
</template>

<script>
  import {listApi} from "../../../../api/manage/statistics";

  export default {
    name: "Api",
    data () {
      return {
        apiTable: [],
        searchForm: {}
      }
    },
    methods: {
      listApi () {
        listApi(this.searchForm).then(result => {
          this.apiTable = result.data.statisticsApi
        }).catch(error => {
          console.log(error)
        })
      }
    },
    created () {
      this.listApi()
    }
  }
</script>

<style scoped>
    .manage-api {
        width: 100%;
        height: 100%;
    }

    /* element ui样式重写 */
    .manage-api > .el-table {
        height: calc(100% - 40px) !important;
    }

    .manage-api > .el-table > .el-table__body-wrapper {
        height: calc(100% - 40px) !important;
    }
</style>